//
//  BoxMangerTableViewCell.m
//  workApp
//  Created by 林 on 2019/1/10.
//  Copyright © 2019 林. All rights reserved.
//

#import "BoxMangerTableViewCell.h"
#import "BoxMangerBtn.h"
@implementation BoxMangerTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    self.backgroundColor = [UIColor colorWithHexStr:@"#fafafa"];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    if (self) {
        self.backView = [[UIView alloc]initWithFrame:CGRectMake(20, 20, MDSCREEN_WIDTH - 40, 150)];
        self.backView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.backView];
        
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 25, 150, 35)];
        self.nameLabel.font = [UIFont boldSystemFontOfSize:20];
        self.nameLabel.font = [UIFont systemFontOfSize:18];
        self.nameLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.nameLabel];
        
        
        BoxMangerBtn * deleteBtn = [[BoxMangerBtn alloc]initWithFrame:CGRectMake(MDSCREEN_WIDTH - 70, 20, 40, 55)];
        deleteBtn.backgroundColor = [UIColor whiteColor];
        deleteBtn.imageV.image = [UIImage imageNamed:@"laji"];
        deleteBtn.nameLab.text = @"删除";
        [deleteBtn addTarget:self action:@selector(deleteClick) forControlEvents:(UIControlEventTouchUpInside)];
        [self.contentView addSubview:deleteBtn];
        
        BoxMangerBtn * manberManagerBtn = [[BoxMangerBtn alloc]initWithFrame:CGRectMake(MDSCREEN_WIDTH - 150, 20, 70, 55)];
        manberManagerBtn.backgroundColor = [UIColor whiteColor];
        manberManagerBtn.imageV.image = [UIImage imageNamed:@"member"];
        manberManagerBtn.nameLab.text = @"成员管理";
        [manberManagerBtn addTarget:self action:@selector(manberMangerClick:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.contentView addSubview:manberManagerBtn];
        
        BoxMangerBtn * rebandingBtn = [[BoxMangerBtn alloc]initWithFrame:CGRectMake(MDSCREEN_WIDTH - 230, 20, 70, 55)];
        rebandingBtn.backgroundColor = [UIColor whiteColor];
        rebandingBtn.nameLab.text = @"重新绑定";
        rebandingBtn.imageV.image = [UIImage imageNamed:@"erweima"];
        [rebandingBtn addTarget:self action:@selector(rebanding) forControlEvents:(UIControlEventTouchUpInside)];
        [self.contentView addSubview:rebandingBtn];
        
    }
    return self;
}
- (void)deleteClick{
    self.deleteBlock(@"123");
}
- (void)rebanding
{
    self.rebandingBlock(@"123");
}
- (void)sendArray:(NSArray *)array
{
    for (int i = 0; i<array.count; i++) {
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(20 * ScaleW + ((MDSCREEN_WIDTH - 120)/3+20)*(i%3), 90 + 55* (i/3), (MDSCREEN_WIDTH - 120)/3, 45)];
        label.font = [UIFont systemFontOfSize:16];
        label.textAlignment = NSTextAlignmentCenter;
        label.layer.borderColor = [UIColor colorWithHexStr:@"#e1e1e1"].CGColor;
        NSDictionary * dic = array[i];
        label.layer.borderWidth = 1;
        label.layer.cornerRadius = 22;
        label.layer.masksToBounds = YES;
        label.text = dic[@"name"];
        [_backView addSubview:label];
    }
    self.backView.frame = CGRectMake(20, 20, MDSCREEN_WIDTH - 40, 125 + 55* array.count/3);
    self.heightCell = 145 + 55* array.count/3;
}
- (void)manberMangerClick:(UIButton *)btn{
//    NSLog(@"123");
    self.menberBlock(@"123");
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
